package com.kefu.chat.vo;

import org.apache.commons.lang3.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractSearchVo;
import com.kefu.chat.model.ChatVideos;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author hxh
 * @date 2022/10/26
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "")
public class ChatVideosSearchVo extends AbstractSearchVo {

    @ApiModelProperty(value = "坐席id")
    private String agentId;
    @ApiModelProperty(value = "坐席名称")
    private String agentName;
    @ApiModelProperty(value = "呼叫类型0:语音通话，1:视频通话")
    private Integer videoType;
    @ApiModelProperty(value = "通话类型0:呼出，1:呼入")
    private Integer conversationType;
    @ApiModelProperty(value = "接听状态，0 未接听,1 已接听开始")
    private Integer videoTimeStatusStart;
    @ApiModelProperty(value = "接听状态，0 未接听,1 已接听结束")
    private Integer videoTimeStatusEnd;
    @ApiModelProperty(value = "通话时长开始")
    private Long videoTimeStart;
    @ApiModelProperty(value = "通话时长结束")
    private Long videoTimeEnd;
    @ApiModelProperty(value = "创建时间开始")
    private Long createTimeStart;
    @ApiModelProperty(value = "创建时间结束")
    private Long createTimeEnd;
    @ApiModelProperty(value = "修改时间开始")
    private Long updateTimeStart;
    @ApiModelProperty(value = "修改时间结束")
    private Long updateTimeEnd;
    @ApiModelProperty(value = "用户id")
    private String userId;
    @ApiModelProperty(value = "用户姓名")
    private String userName;

    @ApiModelProperty(value = "统计开始时间")
    private Long statisticsDateStart;

    @ApiModelProperty(value = "统计结束时间")
    private Long statisticsDateEnd;


	 @Override
    public  LambdaQueryWrapper<ChatVideos> lambdaQuery(){
    	LambdaQueryWrapper<ChatVideos> wrapper=Wrappers.<ChatVideos>lambdaQuery();
	    wrapper.eq(StringUtils.isNotBlank(agentId), ChatVideos::getAgentId, agentId);
	    wrapper.eq(StringUtils.isNotBlank(agentName), ChatVideos::getAgentName, agentName);
		wrapper.eq(videoType!=null, ChatVideos::getVideoType, videoType);
		wrapper.eq(conversationType!=null, ChatVideos::getConversationType, conversationType);
		wrapper.ge(videoTimeStatusStart!=null, ChatVideos::getVideoTimeStatus, videoTimeStatusStart);
		wrapper.le(videoTimeStatusEnd!=null, ChatVideos::getVideoTimeStatus, videoTimeStatusEnd);
		wrapper.ge(videoTimeStart!=null, ChatVideos::getVideoTime, videoTimeStart);
		wrapper.le(videoTimeEnd!=null, ChatVideos::getVideoTime, videoTimeEnd);
		wrapper.ge(createTimeStart!=null, ChatVideos::getCreateTime, createTimeStart);
		wrapper.le(createTimeEnd!=null, ChatVideos::getCreateTime, createTimeEnd);
		wrapper.ge(updateTimeStart!=null, ChatVideos::getUpdateTime, updateTimeStart);
		wrapper.le(updateTimeEnd!=null, ChatVideos::getUpdateTime, updateTimeEnd);
	    wrapper.eq(StringUtils.isNotBlank(userId), ChatVideos::getUserId, userId);
	    wrapper.eq(StringUtils.isNotBlank(userName), ChatVideos::getUserName, userName);
	    wrapper.eq(ChatVideos::getTenantId, KefuContext.getKefuContext().getTenantId());
	    
    	return wrapper;
	}
}